﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="spread_information.aspx.cs" Inherits="Spread_spread_information" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
    <script type="text/javascript" src="../js/jquery1.6.2.js"></script>
    <script type="text/javascript" src="../js/jquery.query.get.js"></script>
    <script type="text/javascript">
      $(function(){
         var edit=$.query.get("id");
         $("div").hide();
         if(edit=="basic")
         {$("#basic").show();}
         if(edit=="bank")
         {$("#bank").show();}
         if(edit=="password")
         {$("#password").show();}
         $.ajax({
              anysc:false,
              url:'API/A_Spreadlogon.aspx',
              type:'POST',
              data:{edit:'info'},
              dataType:'json',
              success:function(data)
              {
                $("#name").val(data.name);
                $("#img").attr("src",data.image);
                $("#tel").val(data.tel);
                $("#email").val(data.email);
                $("#qq").val(data.qq);
                $("#bankname").val(data.bank);
                $("#bankusername").val(data.bankname);
                $("#bankcode").val(data.bankcode);
                $("#logontime").text(data.logontime);
                $("#logonip").text(data.logonip);
              }
         })
         function LogonOut()
         {
           $.ajax({
                 anysc:false,
                 url:'API/A_Spreadlogon.aspx',
                 type:'POST',
                 data:{edit:'logonout'},
                 success:function(msg)
                 {
                   if(msg=="true")
                   {
                     window.parent.location.reload();
                   }
                 }
           })
         }
         function reload()
         {
           window.location.reload();
         }
         function InfoUpdate()
         {
           var qq=$("#qq").val();
           var tel=$("#tel").val();
           var email=$("#email").val();
           $.ajax({
                  anysc:false,
                  url:'API/A_Spreadlogon.aspx',
                  type:'POST',
                  data:{edit:'infoupdate',
                        q:qq,
                        t:tel,
                        e:email
                  },
                  success:function(msg){
                    if(msg=="true")
                    {
                       reload();}
                  }
                  
           })
         }
         function BankUpdate()
         {
           var bank=$("#bankname").val();
           var bankname=$("#bankusername").val();
           var bankcode=$("#bankcode").val();
           $.ajax({
                 anysc:false,
                 url:'API/A_Spreadlogon.aspx',
                 type:'POST',
                 data:{edit:'bankupdate',
                       b:bank,
                       n:bankname,
                       c:bankcode
                 },
                 success:function(msg)
                 {
                   if(msg=='true')
                   {reload();}
                 }
           })
         }
         function PasswordUpdate()
         {
           var oldpass=$("#oldpass").val();
           var newpass=$("#newpass").val();
           var secondpass=$("#secondpass").val();
           if(newpass==secondpass)
           {
             $.ajax({
                    anysc:false,
                    url:'API/A_Spreadlogon.aspx',
                    type:'POST',
                    data:{edit:'passwordupdate',
                          o:oldpass,
                          n:secondpass
                    },
                    success:function(msg)
                    {
                       if(msg=="true")
                       {LogonOut();}
                       if(msg=="false")
                       {alert("密码输入错误，请重新输入！");}
                    }
             })
           }
           if(newpass!=secondpass)
           {
              alert("两次输入密码不一致！");
           }
         }
         $("#infocancel").click(function(){reload();});
         $("#bankcancel").click(function(){reload();});
         $("#passwordcancel").click(function(){reload();});
         $("#infoupdate").click(function(){InfoUpdate();});
         $("#bankupdate").click(function(){BankUpdate();});
         $("#passwordupdate").click(function(){PasswordUpdate();});
      })
    </script>
</head>
<body>
    <form id="form1" runat="server">
      <div id="basic">
        <table>
          <tr>
            <td>姓名：</td><td><input id="name" type="text" readonly="readonly" style="border:0;"/></td>
          </tr>
          <tr>
            <td colspan="2">身份证：<br /><img id="img" alt="身份证" src="" /></td>
          </tr>
          <tr>
            <td>电话：</td><td><input id="tel" type="text" /></td>
          </tr>
          <tr>
            <td>Email：</td><td><input id="email" type="text" /></td>
          </tr>
          <tr>
            <td>QQ：</td><td><input id="qq" type="text" /></td>
          </tr>
          <tr>
            <td>登录时间：</td>
            <td id="logontime"></td>
          </tr>
          <tr>
            <td>登录IP：</td>
            <td id="logonip"></td>
          </tr>
          <tr>
            <td colspan="2"><input id="infoupdate" type="button" value="提交" /><input id="infocancel" type="button" value="取消" /></td>
          </tr>
        </table>
      </div>
      <div id="bank">
        <table>
          <tr>
            <td>开户行：</td>
            <td><input id="bankname" type="text" /></td>
          </tr>
          <tr>
            <td>开户名称：</td>
            <td><input id="bankusername" type="text" /></td>
          </tr>
          <tr>
            <td>银行卡号：</td>
            <td><input id="bankcode" type="text" /></td>
          </tr>
          <tr>
            <td colspan="2"><input id="bankupdate" type="button" value="提交" /><input id="bankcancel" type="button" value="取消" /></td>
          </tr>
        </table>
      </div>
      <div id="password">
        <table>
          <tr>
            <td>旧密码：</td>
            <td><input id="oldpass" type="password" /></td>
          </tr>
          <tr>
            <td>新密码：</td>
            <td><input id="newpass" type="password" /></td>
          </tr>
          <tr>
            <td>确认密码：</td>
            <td><input id="secondpass" type="password" /></td>
          </tr>
          <tr>
            <td colspan="2"><input id="passwordupdate" type="button" value="提交" /><input id="passwordcancel" type="button" value="取消" /></td>
          </tr>
        </table>
      </div>
    </form>
</body>
</html>
